Developer Documentation

QuickTime 4 API Documentation

Programming With QuickTime VR

| Previous | Chapter Contents | Chapter Top | Next |

Managing Hot Spots

The QuickTime VR Manager provides functions that you can use to manage the hot spots of a node.

QTVRPtToHotSpotID

You can use the QTVRPtToHotSpotID function to get the ID of the hot spot, if any, that lies beneath a point.

OSErr QTVRPtToHotSpotID (QTVRInstance qtvr, Pointpt, UInt32*hotSpotID);
qtvr
An instance of a QuickTime VR movie.
pt
A point, in the local coordinates of the graphics world of the specified movie.
hotSpotID
On entry, a pointer to a long integer. On exit, that long integer contains the ID of the hot spot that lies beneath the specified point, or the value 0 if no hot spot lies beneath that point.
function result
A result code.

DESCRIPTION

The QTVRPtToHotSpotID function returns, in the long integer pointed to by the hotSpotID parameter, the ID of the hot spot in the QuickTime VR movie specified by the qtvr parameter that lies directly under the point specified by the pt parameter. If no hot spot lies under that point, the long integer is set to 0.

QTVRGetHotSpotType

You can use the QTVRGetHotSpotType function to get the type of a hot spot.

OSErr QTVRGetHotSpotType (
                     QTVRInstance qtvr,
                     UInt32 hotSpotID,
                     OSType *hotSpotType);
qtvr
An instance of a QuickTime VR movie.
hotSpotID
A hot spot ID.
hotSpotType
On entry, a pointer to a long integer. On exit, that long integer contains the type of the hot spot specified by the hot spot ID.
function result
A result code.

DESCRIPTION

The QTVRGetHotSpotType function gets the type of a hot spot whose ID you specify. In combination with the kQTVRGetHotSpotTypeSelector intercept selector, this allows an application to change a hot spot's type dynamically.

For example, an application can take an existing movie and cause VR to display the cursors for a type of hotspot different from the one the movie was originally authored with. In combination with intercepting kQTVRTriggerHotSpotSelector , this would allow an Internet plugin to override undefined or link hotspots in movies to make them appear and act as though they are URL links instead. If kQTVRTriggerHotSpotSelector is not intercepted, VR will attempt to act on the hotspot in the normal way; by storing both link and URL data in a file, the exact behavior can be determined at runtime by an application to allow linking to either another node locally or a remote URL link, depending on system configuration or other arbitrary considerations.

SEE ALSO

Use kQTVRGetHotSpotTypeSelector to set the selector for the intercept procedure.

QTVRTriggerHotSpot

You can use the QTVRTriggerHotSpot function to trigger a hot spot.

OSErr QTVRTriggerHotSpot (
                     QTVRInstance qtvr,
                     UInt32hotSpotID,
                     QTAtomContainernodeInfo,
                     QTAtomselectedAtom);
qtvr
An instance of a QuickTime VR movie.
hotSpotID
A hot spot ID.
nodeInfo
A node information atom container (obtained from a previous call to QTVRGetNodeInfo ). You can pass the value 0 in this parameter to have the QuickTime VR Manager determine the appropriate node information atom container.
selectedAtom
The atom of the hot spot to trigger. You can pass the value 0 in this parameter to have the QuickTime VR Manager determine the appropriate hot spot atom.
function result
A result code.

DESCRIPTION

One way you can use the QTVRTriggerHotSpot function is to execute any hot spot without the user's having clicked the hot spot. Usually, you need only specify the qtvr instance and the hot spot ID. You can pass zero for the nodeInfo and selectedAtom parameters.

The more common use of the QTVRTriggerHotSpot function is not in calling it directly, but in setting up an intercept procedure on it. The QTVRTriggerHotSpot function is called internally by the QuickTime VR Manager whenever a user clicks a hot spot. You can intercept calls to trigger your custom hot spots, which allows you to perform any custom actions you desire.

When the QTVRTriggerHotSpot function is called internally (and then intercepted by your intercept procedure), the nodeInfo and selectedAtom parameters have been properly set by the QuickTime VR Manager and are available for your use. For undefined hot spots that do not have an associated hot spot atom in the node info atom container, the selectedAtom parameter will be set to zero.

SPECIAL CONSIDERATIONS

You can call QTVRTriggerHotSpot even on hot spots that are currently disabled.

SEE ALSO

Use QTVRInstallInterceptProc to install an intercept procedure. Listing 4-2 in Chapter 4, "QuickTime VR Atom Containers," shows an example of using an intercept procedure on the QTVRTriggerHotSpot function.

QTVREnableHotSpot

You can use the QTVREnableHotSpot function to enable or disable one or more hot spots.

OSErr QTVREnableHotSpot (
                     QTVRInstance qtvr,
                     UInt32enableFlag,
                     UInt32hotSpotValue,
                     Booleanenable);
qtvr
An instance of a QuickTime VR movie.
enableFlag
The kind of hot spot or hot spots to enable or disable. See "Hot Spot Selectors" for a description of the constants you can pass in this parameter.
hotSpotValue
The desired hot spot or spots, relative to the specified enabled flag. If  enableFlag is kQTVRHotSpotID , this parameter specifies a hot spot ID. If enableFlag is kQTVRHotSpotType , this parameter specifies a hot spot type. If enableFlag is kQTVRAllHotSpots , this parameter should be set to zero.
enable
A Boolean value that indicates whether the specified hot spots are to be enabled ( true ) or disabled ( false ).
function result
A result code.

DESCRIPTION

The QTVREnableHotSpot function either enables or disables the hot spot or spots specified by the enableFlag and hotSpotValue parameters, according to the value of the enable parameter. The hot spots are always selected from among the hot spots in the current node of the QuickTime VR movie specified by the qtvr parameter.

Normally, all hot spots in a node are enabled (that is, the cursor automatically changes shape when it is moved over a hot spot, and the QTVRTriggerHotSpot function is called internally when the user clicks a hot spot). When a hot spot is disabled, QuickTime VR behaves as if the hot spot were not present.

QTVRSetMouseOverHotSpotProc

You can use the QTVRSetMouseOverHotSpotProc function to install or remove a mouse over hot spot procedure.

OSErr
QTVRSetMouseOverHotSpotProc (
                    QTVRInstance qtvr,
                     QTVRMouseOverHotSpotUPP mouseOverHotSpotProc,
                     SInt32         refCon,
                     UInt32         flags);
qtvr
An instance of a QuickTime VR movie.
mouseOverHotSpotProc
A universal procedure pointer for a mouse over hot spot procedure. See "Mouse Over Hot Spot Procedure" for information about mouse over hot spot procedures.
refCon
A reference constant. This value is passed to the specified mouse over hot spot procedure.
flags
Unused. Set this parameter to 0.
function result
A result code.

DESCRIPTION

The QTVRSetMouseOverHotSpotProc function installs the routine specified by the mouseOverHotSpotProc parameter as a mouse over hot spot procedure for the QuickTime VR movie specified by the qtvr parameter. Subsequent user actions (such as moving the cursor over an enabled hot spot in that movie) cause the callback routine to be executed. The reference constant specified by the refCon parameter is passed unchanged to your callback routine.

To remove a previously installed callback routine, set mouseOverHotSpotProc to  nil .

Your mouse over hot spot procedure is called only for enabled hot spots.

QTVRGetVisibleHotSpots

You can use the QTVRGetVisibleHotSpots function to get a list of the currently visible hot spots in a QuickTime VR movie.

UInt32 QTVRGetVisibleHotSpots (QTVRInstance qtvr, Handle hotSpots);
qtvr
An instance of a QuickTime VR movie.
hotSpots
On entry, a handle to a block of memory. On exit, that block of memory is filled with a list of the IDs of the visible hot spots in the specified QuickTime VR movie. If necessary, the handle is resized to hold all the hot spot IDs. Accordingly, the handle must be unlocked at the time you call QTVRGetVisibleHotSpots .
function result
The number of hot spots whose IDs are returned though the hotSpots parameter.

DESCRIPTION

The QTVRGetVisibleHotSpots function returns, in the block of memory specified by the hotSpots parameter, a list of IDs of all the hot spots in the QuickTime VR movie specified by the qtvr parameter that are currently visible. QTVRGetVisibleHotSpots also returns, as its function result, the number of hot spot IDs returned though the hotSpots parameter.

The handle specified by the hotSpots parameter must be a valid handle created by the Memory Manager.

QTVRGetHotSpotRegion

You can use the QTVRGetHotSpotRegion function to get the region occupied by a hot spot.

OSErr QTVRGetHotSpotRegion (
                     QTVRInstance qtvr,
                     UInt32 hotSpotID,
                     RgnHandlehotSpotRegion);
qtvr
An instance of a QuickTime VR movie.
hotSpotID
A hot spot ID.
hotSpotRegion
On entry, an initialized handle to a region (obtained by calling NewRgn ). On exit, this region is rewritten with the region occupied by the hot spot having the specified ID.
function result
A result code.

DESCRIPTION

The QTVRGetHotSpotRegion function returns, in the hotSpotRegion parameter, a handle to the region occupied by the hot spot, in the QuickTime VR movie specified by the qtvr parameter, whose ID is specified by the hotSpotID parameter. The region is clipped to the bounds of the movie's graphics world.

You can obtain the regions of all visible hot spots by calling the QTVRGetVisibleHotSpots function and then calling QTVRGetHotSpotRegion for each hot spot ID in the list.

SPECIAL CONSIDERATIONS

The first time you call QTVRGetHotSpotRegion , a significant amount of memory might need to be allocated. Accordingly, you should always check for Memory Manager errors returned by QTVRGetHotSpotRegion .

Your application is responsible for disposing of the memory occupied by the returned region.


© 1998 Apple Computer, Inc.

| Previous | Chapter Contents | Chapter Top | Next |